#include "Quantization.h"


Quantization::Quantization(QuantizationMatrix* qm)
{
	_quantizationMatrix = *qm;
}

void Quantization::performQuantization(Matrix& m)
{
	m = m / _quantizationMatrix;
	m.flattenHighValues();
}


Quantization::Quantization( int* data, int columnLength )
{
	QuantizationMatrix q(columnLength);
	q.setMatrix(data);

	_quantizationMatrix = q;
}

Quantization::Quantization( const Quantization& src )
{
	_quantizationMatrix = src.getQuantizationMatrix();
}


Quantization::~Quantization( void )
{

}

int* Quantization::copyToDevice()
{
	int* data;

	cudaMalloc(&data, _quantizationMatrix.getSize() * sizeof(int));
	cudaMemcpy(data, _quantizationMatrix.getQuantizationMatrix(), _quantizationMatrix.getSize() * sizeof(int), cudaMemcpyHostToDevice);

	return data;
}